//点击全选，子复选框被选中
function demo() {
	var allcheck = document.getElementById("allcheck");
	var choice = document.getElementsByName("choice");
	for (var i = 0; i < choice.length; i++) {
		choice[i].checked = allcheck.checked;
	}
	getValue();

}
//点击子复选框,全选框 选中、取消
function setAll() {
	getValue();
	if (!$(".checknum").checked) {
		$("#allcheck").prop("checked", false); // 子复选框某个不选择，全选也被取消
	}
	var choicelength = $("input[type='checkbox'][class='checknum']").length;
	var choiceselect = $("input[type='checkbox'][class='checknum']:checked").length;
	if (choicelength == choiceselect) {
		$("#allcheck").prop("checked", true);
	}
	getValue();

}
//获取复选框选中的值和计算参合费用
function getValue() {
	var count = 0;
	var number = 0; //选中的个数
	var arr = new Array();
	var input = document.getElementsByTagName("input"); //获取所有的input标签
	var str = "选中的值为:";
	var money = document.getElementById("money").value;
	for (var i = 0; i < input.length; i++) {
		var obj = input[i];
		//判断是否是checkbox并且已经选中
		if (obj.type == "checkbox" && obj.checked) {
			var code = obj.value; //获取checkbox的值
			if (code != "on") {
				number += 1;
				//		str = str + code + ",";
				arr.push(code);
			}
		}
		count = number * money; //计算参合费用
	}
	//	document.getElementById("show").innerText = str;
	document.getElementById("show").innerText = count;
	document.getElementById("arr").innerText = arr;
	document.getElementById("stat").innerText = stat;
}